<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">  
    <title>项目管理</title>
    <meta name="description" content="">
    <meta name="author" content="templatemo">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/templatemo-style.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="js/teacher.js"></script>
  </head>
  <body>  
    <?php 
    require_once("../congfig/config.php");
    require_once("./system/loginCheck.php");
     ?>
    <!-- Left column -->
    <div class="templatemo-flex-row">
      <div class="templatemo-sidebar">
        <header class="templatemo-site-header">
          <div class="square"></div>
          <h1>教师管理系统</h1>
         
        </header>
        
        <div class="profile-photo-container">
          <img src="images/profile-photo.jpg" alt="Profile Photo" class="img-responsive"> 
        </div>      
        <!-- Search box -->
     
        <div class="mobile-menu-icon">
            <i class="fa fa-bars"></i>
        </div>
        <nav class="templatemo-left-nav">          
            <ul>
              <li><a href="../index.php"><i class="fa fa-map-marker fa-fw"></i>首页</a></li>
                <li id="xmgl"><a href="#" class="active"><i class="fa fa-bars fa-fw"></i>我的项目</a> </li>
                <li id="yhgl"><a href="addProject.php" ><i class="fa fa-fire fa-fw"></i>发布项目</a></li>
                <li id="grxx"><a href="tOwner.php" ><i class=" fa fa-user fa-fw"></i>个人信息</a></li>
                <li><a href="pad-check.php"><i class="fa fa-cog fa-fw"></i>修改密码</a></li>
                <li><a href="../loginout.php"><i class="fa fa-map-marker fa-fw"></i>注销</a></li>
            </ul>
        </nav>
      </div>
      <!-- Main content --> 
      <div class="templatemo-content col-1 light-gray-bg" style="height:1000px;">
          <div class="container" style="margin-top:100px;">
              <div role="tabpanel" class="tab-pane active" id="sour">
                  <div class="check-div form-inline">
                          <div class="col-xs-4">
                            <form action="">
                              <input type="text" name="key" class="form-control input-sm">
                              <input type="submit" value="查 询" class="btn btn-white btn-xs "> 
                            </form>
                          </div>  
                  </div>
              <div class="data-div">
                <?php 
                $teacher=$_SESSION['username'];
                $sql="select * from proinfor where teacher='$teacher'";
                if(isset($_GET["key"])){
                  $key=$_GET["key"];
                  $sql="select * from proinfor where pName like '%{$key}%' and teacher='$teacher'";
                }

                $result=$conn ->query($sql);
                $i=1;
                 ?>
                  <table class="table table-hover table-striped">
                      <thead>
                          <tr>
                              <th>编号</th>
                              <th>项目名称</th>
                              <th>项目负责人</th>
                              <th>指导教师</th>
                              <th>操作</th>
                              <th>项目状态</th>
                          </tr>
                      </thead>
                      <?php 
                      while ($row=$result->fetch_array()){

                       ?>
                      <tbody>
                          <tr>
                              <td id="project-id"><?php echo $i++; ?></td>
                              <td><?php echo $row["pName"]; ?></td>
                              <td><?php echo $row["pChar"]; ?></td>
                              <td><?php echo $row["teacher"]; ?></td>
                              <td>
                              <a class="btn btn-info btn-xs" href="alterProjectUser.php?pid=<?php echo $row["id"]; ?>">成员管理</a>
                              <a class="btn btn-warning btn-xs" href="addProjectUser.php?pid=<?php echo $row["id"]; ?>">添加成员</a>
                              <a class="btn btn-success btn-xs" href="alterProject.php?pid=<?php echo $row["id"]; ?>">修改项目</a>
                              </td>
                              <td><div class="btn btn-success btn-xs"><?php 
                              if ($row["pRank"]==0) {
                        echo "申请立项";
                    }
                    elseif ($row["pRank"]==1) {
                        echo "立项成功";
                    }
                    elseif ($row["pRank"]==2) {
                        echo "立项失败";
                    }
                    elseif ($row["pRank"]==3) {
                        echo "申请结项";
                    }
                    elseif ($row["pRank"]==4) {
                        echo "结项成功";
                    }
                    elseif ($row["pRank"]==5) {
                        echo "结项失败";
                    }
                    elseif ($row["pRank"]==6) {
                        echo "逾期项目";
                    } ?></div></td>
                          </tr>

                      </tbody>
                    <?php 
                  }//while end
                     ?>
                  </table>
              </div>
          </div>
          </div>
       </div>
    </div>
  </body>
</html>